import java.util.HashMap;
import java.util.Map;

public class Jakespec {
    private final Map<String, String> globalConfig = new HashMap<>();
    private final Map<String, Target> targets = new HashMap<>();

    public Jakespec(Map<String, String> globalConfig, Map<String, Target> targets) {
        this.globalConfig.putAll(globalConfig);
        this.targets.putAll(targets);
    }

    public String getGlobalConfig(String key) {
        return globalConfig.getOrDefault(key, null);
    }

    public String getClasspath() {
        return getGlobalConfig("classpath");
    }

    public String getSourceDir() {
        return getGlobalConfig("sourcedir");
    }

    public String getOutputDir() {
        return getGlobalConfig("outputdir");
    }

    public boolean hasTarget(String targetName) {
        return targets.containsKey(targetName);
    }

    public Target getTarget(String targetName) {
        return targets.get(targetName);
    }

    public Map<String, Target> getTargets() {
        return new HashMap<>(targets);
    }
}